package com.glenet.salary.action;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.glenet.salary.dao.HrPreDetailDao;
import com.glenet.salary.entities.HrPreDetail;

@SuppressWarnings("serial")
public class HrPreDetailAction extends MultifileUploadAction {

	private HrPreDetailDao preDetailDao = new HrPreDetailDao();
	private List<HrPreDetail> list;

	@Override
	public String execute() throws Exception {

		HttpServletResponse resp = ServletActionContext.getResponse();
		resp.reset();
		resp.setContentType("application/vnd.ms-excel;charset=UTF-8");
		resp.setHeader("Content-Disposition", "attachment;filename=export_excel.xls");

		return null;
	}

	public String index() throws Exception {
		list = preDetailDao.list(offset, limit);
		System.out.println("list" + list.size());
		return SUCCESS;
	}

	public String none() throws Exception {
		list = preDetailDao.list(offset, limit);
		return SUCCESS;
	}

	@Override
	protected String importing() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String toUpload() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	public List<HrPreDetail> getList() {
		return list;
	}

	public void setList(List<HrPreDetail> list) {
		this.list = list;
	}

}
